package org.example.util6;

import java.util.Arrays;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;

public class LambdaTest {
    public static void main(String[] args) {
     String[] planets = new String[]{"Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"};
        System.out.println(Arrays.toString(planets));
        System.out.println("Sorted planets:");
        Arrays.sort(planets);
        System.out.println(Arrays.toString(planets));
        System.out.println("Sorted by length:");
        Arrays.sort(planets, (a, b) -> a.length() - b.length());
        System.out.printf(Arrays.toString(planets));
//        Timer timer = new Timer(1000,event -> {
//            System.out.println("The time is " + new Date());
//        });
//        timer.start()
    }

}
